package com.mycompany.project.client;

import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.PasswordTextBox;

public class DialogoVerificarLogin extends DialogBox {

	TextBox textBox = new TextBox();
	PasswordTextBox passwordTextBox = new PasswordTextBox();
	
	public DialogoVerificarLogin() {
		setGlassEnabled(true);
		setHTML("Log In");
		
		AbsolutePanel absolutePanel = new AbsolutePanel();
		absolutePanel.setStyleName("gwt-SuggestBoxPopup");
		setWidget(absolutePanel);
		absolutePanel.setSize("337px", "158px");
		
		Label lblNoEstaImplementado = new Label("");
		absolutePanel.add(lblNoEstaImplementado, 10, 26);
		
		Button btnOk = new Button("OK");
		btnOk.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent arg0) {
				DialogoVerificarLogin.this.hide();
				Inicio inic = Inicio.darInstancia();
				inic.verificarLogin(textBox.getText(),passwordTextBox.getText());
				inic.rootPanel.clear();
				inic.onModuleLoad();
			}
		});
		absolutePanel.add(btnOk, 57, 120);
		btnOk.setSize("100px", "28px");
		
		Label lblPorFavorHacer = new Label("Por favor identificarse en el sistema");
		absolutePanel.add(lblPorFavorHacer, 10, 10);
		
		Label lblLogin = new Label("Login:");
		absolutePanel.add(lblLogin, 22, 46);
		
		Label lblPassword = new Label("Password:");
		absolutePanel.add(lblPassword, 22, 77);
		lblPassword.setSize("35px", "18px");
				
		absolutePanel.add(textBox, 90, 36);
		
		absolutePanel.add(passwordTextBox, 90, 70);
		
		Button btnCancelar = new Button("Cancelar");
		btnCancelar.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent arg0) {
				DialogoVerificarLogin.this.hide();
				Inicio inic = Inicio.darInstancia();
				inic.rootPanel.clear();
				inic.onModuleLoad();
			}
		});
		absolutePanel.add(btnCancelar, 214, 120);
		btnCancelar.setSize("100px", "28px");
	}
}
